{extend name="public:base" /}
{block name="theme"}架构管理{/block}
{block name="small_theme"}会员列表{/block}
{block name="breadcrumb"}
<li><a href="{:url('index')}">会员列表</a></li>
<li class="active">会员首页</li>
{/block}
{block name="content"}
<link rel="stylesheet" href="__CSS__/indexcommon.css">
<section class="content" style="min-height: 60px;font-size: 14px;">
    <form method="post" action="{:url('index')}" >
        <div class="box_">
            <div class="box_left">
                <div class="form-group">
                    <label>用户名或id或手机</label>
                    <input type="text" class="form-control" name="keyword" placeholder="用户名,id,手机" value="{$keyword}" >
                </div>
                <div class="form-group">
                    <label>部门</label>
                    <select class="form-control" name="depar_id">
                        <option value="0" >全部</option>
                        {volist name="depar" id="data"}
                            <option value="{$data.id}" {eq name="$map.depar_id" value="$data.id"}selected="selected"{/eq}>{$data.name}</option>
                        {/volist}
                    </select>
                </div>
                <div class="form-group">
                    <label>用户状态</label>
                    <select class="form-control" name="status">
                        <option value="0" >全部</option>
                        <option value="1" {eq name="$map.status" value="1"}selected="selected"{/eq}>正常</option>
                        <option value="2" {eq name="$map.status" value="2"}selected="selected"{/eq}>禁用</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>微信状态</label>
                    <select class="form-control" name="weixinstatus">
                        <option value="0" >全部</option>
                        <option value="1" {eq name="$map.weixinstatus" value="1"}selected="selected"{/eq}>已绑定</option>
                        <option value="2" {eq name="$map.weixinstatus" value="2"}selected="selected"{/eq}>未绑定</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>地区</label>
                    <select class="form-control" name="dq_id">
                        <option value="0" >全部</option>
                        {volist name="dq" id="data"}
                        <option value="{$data.id}" {eq name="$map.dq_id" value="$data.id"}selected="selected"{/eq}>{$data.name}</option>
                        {/volist}
                    </select>
                </div>
                <div class="form-group">
                    <label>门店</label>
                    <select class="form-control" name="group_id">
                        <option value="0" >全部</option>
                        {volist name="group" id="data"}
                            <option value="{$data.id}" {eq name="$map.group_id" value="$data.id"}selected="selected"{/eq}>{$data.title}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="box_right">
                <button class="btn btn-primary">开始查询</button>
            </div>
        </div>
    </form>
</section>
<div class="row" style="padding:15px;">
    <div class="col-xs-12">
        <div class="box box-list">
            <div class="box-header" data-original-title="" style="height: 40px;">
                <a href="{:url('add')}" class="btn"><h2 style="margin-top: 0;"><i class="glyphicon glyphicon-plus"></i>新增会员</h2></a>
                <!--<button type="button" class="btn" id="abtn" style="border:none;outline: none;box-shadow: none;"><h2 style="margin-top: 0"><i class="glyphicon glyphicon-tags"></i> 显示选项</h2></button>-->
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding" style="border-bottom: 1px solid #dfdfdf;overflow: hidden;">
                <table class="table table-striped table-bordered table-condensed table-hover">
                    <tr>
                        <th>ID</th>
                        <th >用户名</th>
                        <th >角色</th>
                        <th >部门</th>
                        <th >分组</th>
                        <th >地区</th>
                        <th >门店</th>
                        <th >电话</th>
                        <th >状态</th>
                        <th >微信</th>
                        <th >最后登陆</th>
                        <!--<th >最后登陆ip</th>-->
                        <th>操作</th>
                    </tr>
                    {empty name="Users"}
                    <tr style='text-align:center;'>
                        <td colspan="13">暂时没有人员！</td>
                    </tr>
                    {else /}
                    {volist name="Users" id='v'}
                    <tr>
                        <td>{$v.id}</td>
                        <td>{$v.username}</td>
                        <td>{$v.title}</td>
                        <td>{$v.depar.name}</td>
                        <td>{$v.ygroup.group_name}</td>
                        <td>{$v.dq.name}</td>
                        <td>{$v.group.title}</td>
                        <td>{$v.phone}</td>
                        <td class="center">{$v.status_text}</td>
                        <td class="center">{$v.weixinstatus_text}</td>
                        <td>{$v.last_login_time}</td>
                        <!--<td>{$v.last_login_ip}</td>-->
                        <td>
                            {if condition="is_administrator()"}
                            <a class="btn btn-nopadding" href="javascript:opengroup('{:url('group',['id'=>$v['id']])}');" title="授权">
                                <i class="glyphicon glyphicon-ok icon-white"></i>
                            </a>
                            {/if}
                            <a class="btn btn-nopadding" href="{:url('edit',['id'=>$v['id']])}" title="编辑">
                                <i class="glyphicon glyphicon-edit icon-white"></i>
                            </a>
                            <a class="btn btn-nopadding" href="javascript:opendel('{:url('del',['id'=>$v['id']])}');" title="禁用">
                                <i class="glyphicon glyphicon-trash icon-white"></i>
                            </a>
                            <a class="btn btn-nopadding" href="javascript:setstates('{:url('setstates',['id'=>$v['id']])}');" alt="负责医院" title="负责医院">
                                <i class="glyphicon glyphicon-heart icon-white"></i>
                            </a>
                            <a class="btn btn-nopadding" href="javascript:jiebang('{:url('jiebang',['id'=>$v['id']])}');" alt="解除微信绑定" title="解除微信绑定">
                                <i class="glyphicon glyphicon-wrench icon-white"></i>
                            </a>

                            <!--<a class="" href="javascript:jiebang('{:url('jiebang',['id'=>$v['id']])}');">解绑</a>-->
                        </td>
                    </tr>
                    {/volist}
                    {/empty}
                </table>
            </div>
            <!-- /.box-body -->
            {$page}
            <!--<ul class="pagination pagination-centered pagination-list">-->
                <!--<li><a href="#">上一页</a></li>-->
                <!--<li class="active">-->
                    <!--<a href="#">1</a>-->
                <!--</li>-->
                <!--<li><a href="#">2</a></li>-->
                <!--<li><a href="#">3</a></li>-->
                <!--<li><a href="#">4</a></li>-->
                <!--<li><a href="#">下一页</a></li>-->
            <!--</ul>-->
        </div>
        <!-- /.box -->
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
    function opendel(url){
        layer.confirm('确定禁用该用户？', {
            btn: ['禁用','取消'] //按钮
        }, function(){
            $.post(url,complete2);
        }, function(){
            layer.msg('下次不要这么调皮了', {
                icon: 2,
            });
        });
    }
    function opengroup(url){
        layer.open({
            type: 2,
            anim:6,
            title: '用户组授权',
            skin: 'layui-layer-lan', //样式类名
            shadeClose: true,
            shade: 0.8,
            area: ['50%', '80%'],
            content: url,
            end:function(){
                history.go(0);
            }
        });
    }

    function setstates(url){
        layer.open({
            type: 2,
            anim:6,
            title: '设置状态',
            skin: 'layui-layer-lan', //样式类名
            shadeClose: true,
            shade: 0.8,
            area: ['50%', '80%'],
            content: url,
            end:function(){

            }
        });
    }

    function jiebang(url){
        layer.confirm('确定解绑？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post(url,function(data){
                layer.msg(data.msg, {
                    icon: data.code,
                    time:2000,
                },function(){
                    history.go(0);
                });
            });
        });
    }
    highlight_subnav("{:url('index')}");
</script>
{/block}